package com.bupt.liutong.front.sch.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.bupt.liutong.admin.core.base.BaseAction;
import com.bupt.liutong.admin.sch.bo.NewsBo;
import com.bupt.liutong.admin.sch.form.NewsForm;

public class NewsAction extends BaseAction {

	private NewsBo newsBo;
	
	public ActionForward list(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		NewsForm newsForm = (NewsForm) form;
		newsForm.setPageSize(8);
		newsForm.setEnabled(1);
		request.setAttribute("newsFormList", newsBo.getNewsesByPage(newsForm,
				request));
		putPageInfo(request, newsForm);
		return mapping.findForward("list");
	}
	
	public ActionForward des(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		NewsForm newsForm = (NewsForm) form;
		request.setAttribute("newsForm", newsBo.getNewsById(newsForm));
		return mapping.findForward("des");
	}
	
	public void setNewsBo(NewsBo newsBo) {
		this.newsBo = newsBo;
	}
}
